package de.tmahr.android;

import de.tmahr.android.logger.LogActivity;
import android.os.Bundle;

public class SaveInstanceTest extends LogActivity
{
	private String text = "";
	private int wert;
	
	public SaveInstanceTest()
	{
		super("SaveInstanceTest");
	}

	@Override
	public void onCreate(Bundle b)
	{
		super.onCreate(b);
		log("onCreate");
		
		if(b!=null)
		{
			log("Bundle != null");
			text = b.getString("keyText");
			wert = b.getInt("keyWert", 0);
		}

		log("wert=" + wert + ", text=" + text);

		text += "A";
		wert++;
	}
	
	@Override
	protected void onSaveInstanceState(Bundle b)
	{
		log("onSaveInstanceState");
		b.putString("keyText", text);
		b.putInt("keyWert", wert);
		super.onSaveInstanceState(b);
	}
	
	@Override
	protected void onPause()
	{
		super.onPause();
		log("onPause");
	}

	@Override
	protected void onStart()
	{
		super.onStart();
		log("onStart");
	}
	
	@Override
	protected void onStop()
	{
		super.onStop();
		log("onStop");
	}

	@Override
	protected void onDestroy()
	{
		super.onDestroy();
		log("onDestroy");
	}
	
	@Override
	protected void onResume()
	{
		super.onResume();
		log("onResume");
	}
	
	@Override
	protected void onRestart()
	{
		super.onRestart();
		log("onRestart");
	}	
}
